package tests.ge;

import ec.Solution;
import ge.BNFGrammarParser;
import ge.GESolution;
import ge.ProductionRule;

import java.io.File;
import java.util.Iterator;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public class GESolutionTest {
	public static void main(String[] args) {
		//Logger.getRootLogger().setLevel(Level.TRACE);
		ProductionRule.MAX_DEPTH = 5;

		BNFGrammarParser parser = new BNFGrammarParser(new File(
				"src/problems/multiplexer/grammar11.txt"),
				"problems.multiplexer.Symbols$");

		GESolution solutionA = new GESolution(3, 3, .2);
		GESolution solutionB = new GESolution(3, 3, .01);

		System.out.println(solutionA);
		System.out.println(solutionB);

		for (Solution s : solutionA.crossover(solutionB)) {
			System.out.println(s);
		}

		Iterator<Integer> iter = solutionA.iterator();
		for (int i = 0; i < solutionA.getNumCodons(); i++) {
			iter.next();
		}

		System.out.println(solutionA.mutate());

	}
}
